﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using HiLand.Utility.Web;

namespace GBFinance.Web.Models
{
    /// <summary>
    /// 记录导航到本站点的代理商信息
    /// </summary>
    public class BrokerCookie : CookieInfo
    {
        private string  brokerGuid= string.Empty;
        /// <summary>
        /// 代理商Guid
        /// </summary>
        public string  BrokerGuid
        {
            get { return brokerGuid; }
            set { brokerGuid = value; }
        }


        /// <summary>
        /// 将外部传递进来的代理商Guid进行保存
        /// </summary>
        public static void SaveBrokerGuid()
        {
            string brokerGuid = RequestHelper.GetValue("bk");
            if (string.IsNullOrWhiteSpace(brokerGuid) == false)
            {
                BrokerCookie brokerCookie = BrokerCookie.Load<BrokerCookie>();
                brokerCookie.BrokerGuid = brokerGuid;
                brokerCookie.Save();
            }
        }

        /// <summary>
        /// 获取代理商的Guid
        /// </summary>
        /// <returns></returns>
        public static string GetBrokerGuid()
        {
            BrokerCookie brokerCookie = BrokerCookie.Load<BrokerCookie>();
            return brokerCookie.BrokerGuid;
        }
    }
}